export default{
  namespaced:true,
  state:{
    //用户当前选择的地址
    addr:"",
    //用户登陆时的信息
    user:JSON.parse(uni.getStorageSync("user") || "{}"),
    //用户编辑的信息
    editUser:""
  },
  mutations:{
    setEditUser(state,info){
      state.editUser = info
    },
    setAddress(state,address){
      state.addr = address
    },
    setUser(state,user){
      state.user = user
      this.commit("user/save")
    },
    save(state){
      uni.setStorageSync("user",JSON.stringify(state.user))
    }
  }
}